package com.silentfish.backend.codeGenerator.bean;

import org.apache.commons.lang3.StringUtils;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 表
 */
public class TableInfo {

	private String dbName;									//库名 如erp_db
	private String tableName;								//表名 如merchant_employee
	private String beanName;								//beanName 如MerchantEmployee
	private String tableDesc;								//表注释
	private Date createTime;								//创建时间

	private String prefix;									//前缀
	private Set<String> propTypePackages;					//bean类导入的包,如java.util.Date，java.math.BigDecimal;等

	private Map<String, String> primaryKey;					//主键
	private List<ColumnInfo> columns;						//字段
	private List<PropertyInfo> allPropInfo;					//属性,属性类型,属性描述
	private Map<String, String> propertiesAnColumns;		//属性,属性类型
	private Map<String, String> insertPropertiesAnColumns;	//属性,属性类型

	private String entityPackage;
	private String daoPackage;
	private String servicePackage;
	private String serviceImplPackage;
	private String controllerPackage;

	public String getDbName() {
		return dbName;
	}

	public void setDbName(String dbName) {
		this.dbName = dbName;
	}

	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public String getBeanName() {
		return beanName;
	}

	public void setBeanName(String beanName) {
		this.beanName = beanName;
	}

	public String getTableDesc() {
		return tableDesc;
	}

	public void setTableDesc(String tableDesc) {
		this.tableDesc = tableDesc;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Map<String, String> getPrimaryKey() {
		return primaryKey;
	}

	public void setPrimaryKey(Map<String, String> primaryKey) {
		this.primaryKey = primaryKey;
	}

	public List<ColumnInfo> getColumns() {
		return columns;
	}

	public void setColumns(List<ColumnInfo> columns) {
		this.columns = columns;
	}

	public Map<String, String> getPropertiesAnColumns() {
		return propertiesAnColumns;
	}

	public void setPropertiesAnColumns(Map<String, String> propertiesAnColumns) {
		this.propertiesAnColumns = propertiesAnColumns;
	}

	public Map<String, String> getInsertPropertiesAnColumns() {
		return insertPropertiesAnColumns;
	}

	public void setInsertPropertiesAnColumns(Map<String, String> insertPropertiesAnColumns) {
		this.insertPropertiesAnColumns = insertPropertiesAnColumns;
	}

	public Set<String> getPropTypePackages() {
		return propTypePackages;
	}

	public void setPropTypePackages(Set<String> propTypePackages) {
		this.propTypePackages = propTypePackages;
	}

	public List<PropertyInfo> getAllPropInfo() {
		return allPropInfo;
	}

	public void setAllPropInfo(List<PropertyInfo> allPropInfo) {
		this.allPropInfo = allPropInfo;
	}

	public String getPrefix() {
		return prefix;
	}

	public void setPrefix(String prefix) {
		this.prefix = prefix;
	}

	public String getEntityPackage() {
		if (StringUtils.isNoneBlank(getPrefix())) {
			return entityPackage + Constants.PACKAGE_SEPARATOR + getPrefix();
		}
		return entityPackage;
	}

	public void setEntityPackage(String entityPackage) {
		this.entityPackage = entityPackage;
	}

	public String getDaoPackage() {
		if (StringUtils.isNoneBlank(getPrefix())) {
			return daoPackage + Constants.PACKAGE_SEPARATOR + getPrefix();
		}
		return daoPackage;
	}

	public void setDaoPackage(String daoPackage) {
		this.daoPackage = daoPackage;
	}

	public String getServicePackage() {
		if (StringUtils.isNoneBlank(getPrefix())) {
			return servicePackage + Constants.PACKAGE_SEPARATOR + getPrefix();
		}
		return servicePackage;
	}

	public void setServicePackage(String servicePackage) {
		this.servicePackage = servicePackage;
	}

	public String getControllerPackage() {
		if (StringUtils.isNoneBlank(getPrefix())) {
			return controllerPackage + Constants.PACKAGE_SEPARATOR + getPrefix();
		}
		return controllerPackage;
	}

	public void setControllerPackage(String controllerPackage) {
		this.controllerPackage = controllerPackage;
	}

	public String getServiceImplPackage() {
		if (StringUtils.isNoneBlank(getPrefix())) {
			return serviceImplPackage + Constants.PACKAGE_SEPARATOR + getPrefix();
		}
		return serviceImplPackage;
	}

	public void setServiceImplPackage(String serviceImplPackage) {
		this.serviceImplPackage = serviceImplPackage;
	}

}
